
TARGET = harmony
export TARGET

# 获得当前程序的顶层目录: 此处后面不能跟空格，否则不能衔接 Makefile.build
ifeq ($(TARGET), harmony) 
TOPDIR := E:/DockerRepo/media-server/code
else 
TOPDIR := $(shell pwd)
endif
export TOPDIR                       # 输出顶层目录
$(warning TOPDIR is $(TOPDIR))

# 静音输出
ifeq ("$(origin V)", "command line")
KBUILD_VERBOSE = $(V)
endif
ifndef KBUILD_VERBOSE
KBUILD_VERBOSE = 0
endif
export KBUILD_VERBOSE

# 调试版本
ifeq ("$(origin D)", "command line")
KBUILD_DEBUG = $(D)
endif
ifndef KBUILD_DEBUG
KBUILD_DEBUG = 0
endif
export KBUILD_DEBUG

program-y += src/io_example
submod-y += ffmpeg/


# 非实体目标
.PHONY:all clean $(submod-y) $(program-y)


# 
# 通过 Makefile.build 引入 Makefile
# 默认只编译程序
#
$(program-y): 
	$(if $(KBUILD_VERBOSE:1=),@) make -C $@ -f $(TOPDIR)/script/Makefile.build
$(submod-y): 
	$(if $(KBUILD_VERBOSE:1=),@) make -C $@ -f $(TOPDIR)/script/Makefile.build

all: $(submod-y) $(program-y)
	


clean:
	@find ./ -name '*.o.d' | xargs rm -rf 
	@find ./ -name '*.o' | xargs rm -rf 
	@find ./ -name '*.a' | xargs rm -rf 
	@#find ./ -name '*.so' | xargs rm -rf 
